import { createRouter, createWebHistory } from 'vue-router'
import Home from '../views/Home.vue'
import Square from '../views/Square.vue'
import Create from '../views/Create.vue'
import Favorites from '../views/Favorites.vue'

export const routes = [// 默认路由指向首页
  {
    path: '/',
    name: 'Home',
    component: Home,
    redirect: '/square' // 默认重定向到广场页面
  },
  {
    path: '/square',
    name: 'Square',
    component: Square
  },
  {
    path: '/create',
    name: 'Create',
    component: Create
  },
  {
    path: '/favorites',
    name: 'Favorites',
    component: Favorites
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router